<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<base href="<%=basePath%>">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Doctaskis</title>
<link href="css/formstyle.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/jquery-ui.min.css" rel="stylesheet" type="text/css" media="screen" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery-ui-1.10.0.custom.js"></script>
<script src="js/validate.js" charset='gb2312'></script>
<script src="plugins/ckeditor/ckeditor.js"></script>
<script>
function saveAction(){
	alert("value"+ $("#documentContent").val());
	$.ajax
	({
		url : 'document.do?actMethod=updateDocumentAction',
	    data : { documentID : $("#documentID").val(), documentTitle : $("#documentTitle").val(), documentContent : $("#documentContent").val()},
	    type : 'POST',
	    success: function(msg){
			if(msg=="success"){
				alert("更新成功！");
			}else{
				alert("Oh no!error:"+msg);
			}
		},
		error: function(msg){
			alert(msg);
		}
	 });
}
	
function backAction(){
	//返回到文档界面
	var shref="jsp/subDocumentManagement.jsp";
	window.location.href=shref;
}

$(function() {
	$("input:submit,input:reset,button").button();
	$( "#accordion" ).accordion({
		heightStyle: "fill"
		
	});
	
	
});
</script>
</head>
<body>
<input type="hidden" id="documentID" name="documentID" value="${documentInfo.documentID}"/>
<div id="wrapper">
	<div id="header">
		<div id="logo">
			<h1><a href="#">doctaskis </a></h1>
			<p> BY AVERY HUO</p>
		</div>
		<div id="menu">
			<ul>
				<li><a href="main.do">首页</a></li>
				<li class="first current_page_item"><a href="documentLibrary.do?actMethod=showDocumentLibraryAction">文档库</a></li>
				<li><a href="jsp/TaskManagement.jsp">日程表</a></li>
				<li><a href="jsp/FriendManagement.jsp">朋友们</a></li>
				<li><a href="#">关于我</a></li>
				<li><a href="#">关于这</a></li>
			</ul>
		</div>
      
	</div>
	<!-- end #header -->
 
   <div id="centerDocuments">
  	<h3 style="padding-top:30px;">编辑文档</h3>
		
		<p>
			<label style="font-size: 20px">
				标题：<input type="text" id="documentTitle" name="documentTitle" size="100" value="${documentInfo.documentName}"/>
			</label>
			<textarea id="documentContent" name="documentContent" class="ckeditor" cols="80" rows="10">
				${documentInfo.documentContent}
			</textarea>
		</p>
		<p>
			<button id="saveDocumentBtn" onclick="saveAction()">保存</button>
			<button id="backDocumentBtn" onclick="backAction()">返回</button>
		</p>
   </div>
	<!-- end #content -->
	<div style="clear: both;">&nbsp;</div>
			
	<!-- end #page -->
</div>
<div id="footer">
	<p>Copyright (c) 2013 Avery.com. All rights reserved. Design by Avery.</p>
</div>
<!-- end #footer -->
</body>
</html>
